#!/usr/bin/php -c/etc/gtk/php.ini
<?php

$package = (array_key_exists('1',$_SERVER['argv']))?($_SERVER['argv'][1]):('');
$version = (array_key_exists('2',$_SERVER['argv']))?($_SERVER['argv'][2]):('');

if(!$version || !$package) {
	echo("\nbuild.php <package> <version>\n\n");
	exit(1);
}

if(is_dir($package)) {

	system("ln -s {$package} {$package}-{$version}");
	system("tar -chjf {$package}-{$version}.tar.bz2 {$package}-{$version} --exclude *.svn* --exclude *.xcf*");
	system("rm -f {$package}-{$version}");
	

} else {
	echo("\ndirectory '{$package}' not found.\n\n");
}

?>